package wqh.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import wqh.dao.WaterDeviceDao;
import wqh.domain.WaterDevice;
import wqh.service.WaterDeviceService;

import java.util.List;

/**
 * Created by devts on 2017/1/5.
 */
@Service("waterDeviceService")
public class WaterDeviceServiceImpl implements WaterDeviceService {

    private final WaterDeviceDao dao;

    @Autowired
    public WaterDeviceServiceImpl(WaterDeviceDao dao) {
        this.dao = dao;
    }

    public void save(WaterDevice entity) {
        this.dao.save(entity);
    }

    public void update(WaterDevice entity) {
        this.dao.update(entity);
    }

    public void delete(WaterDevice entity) {
        this.dao.delete(entity);
    }

    public void deleteAll() {
        this.dao.deleteAll();
    }

    public List<WaterDevice> findAll() {
        return this.dao.findAll();
    }

    public WaterDevice findById(Long id) {
        return this.dao.findById(id);
    }

    public long findIdByIpAndPort(String ip, Integer port) {
        return this.dao.findIdByIpAndPort(ip, port);
    }

    @Override
    public WaterDevice findByDeviceId(long device_id) {
        return this.dao.findByDeviceId(device_id);
    }
}
